<template>
  <div>
    <div>
      <el-table
        v-loading="loading"
        :data="tableData"
        border
        style="width: 100%"
      >
        <el-table-column prop="uid" label="用户ID" width="80">
        </el-table-column>
        <el-table-column prop="uname" label="用户名" width="200">
        </el-table-column>
        <el-table-column prop="uphone" label="用户账号" width="200">
        </el-table-column>
        <el-table-column
          prop="fcontent"
          label="用户反馈"
          width="600"
          show-overflow-tooltip
        >
        </el-table-column>
        <el-table-column label="操作" width="120" fixed="right">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small"
              >查看</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <div class="admin-fenye">
        <el-pagination
          background
          layout="prev, pager, next"
          :total="total"
          :currentPage="curPage"
          @current-change="page"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import { getFeedback } from "../../network/admin";

export default {
  name: "Useropinion",
  data() {
    return {
      tableData: [],
      input: "",
      curPage: 1,
      total: 0,
      loading: true,
    };
  },
  created() {
    this.getMessage();
  },

  methods: {
    getMessage() {
      if (this.$route.query.page != undefined) {
        this.curPage = Number(this.$route.query.page);
      }
      getFeedback(this.curPage).then((res) => {
        this.tableData = res.data.data.list;
        this.total = res.data.data.total;
        this.loading = false;
        console.log(res);
      });
    },

    handleClick(row) {
      this.$alert(row.fcontent, "用户反馈", {
        confirmButtonText: "确定",
      });
    },

    page(currentPage) {
      this.curPage = currentPage;
      this.loading = true;
      this.$router.push({
        path: "useropinion",
        query: {
          page: currentPage,
        },
      });
      this.getMessage();
    },
  },
};
</script>

<style>
</style>